package thread;

import java.util.Scanner;

public class SleepDemo {
    public static void main(String[] args) {
        System.out.println("程序开始了....");
        Scanner scan = new Scanner(System.in);
        System.out.println("请输入一个数字:");
        for (int num= scan.nextInt();num>0;num--){
            System.out.println(num);
        }

        try {
            Thread.sleep(1000);

        } catch (InterruptedException e) {
            e.printStackTrace();
        }
        System.out.println("程序结束了");
    }

}




       /* System.out.println("程序开始了....");
        boolean run = true;
        for (int i = 5; i > 0; i--) {
            if (run) {
                //         获取线程名字
                System.out.println(Thread.currentThread().getName() + "------>" + i + "秒");
                try {
                    Thread.sleep(1000);

                } catch (InterruptedException e) {
                    e.printStackTrace();
                }
            } else {
                return;
            }
        }
        System.out.println("程序结束了");
    }

        */




